<?php

/**
 * Rounds form base class.
 *
 * @method Rounds getObject() Returns the current form's model object
 *
 * @package    gamerstats
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRoundsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idrounds'    => new sfWidgetFormInputHidden(),
      'redscore'    => new sfWidgetFormInputText(),
      'bluescore'   => new sfWidgetFormInputText(),
      'map'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Maps'), 'add_empty' => false)),
      'screen'      => new sfWidgetFormInputText(),
      'war'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Wars'), 'add_empty' => false)),
      'description' => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'idrounds'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idrounds')), 'empty_value' => $this->getObject()->get('idrounds'), 'required' => false)),
      'redscore'    => new sfValidatorNumber(),
      'bluescore'   => new sfValidatorNumber(),
      'map'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Maps'))),
      'screen'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'war'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Wars'))),
      'description' => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('rounds[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Rounds';
  }

}
